package org.lanqiao.music.web.controller;

import com.github.pagehelper.PageInfo;
import org.lanqiao.music.common.dto.AlbumDTO;
import org.lanqiao.music.common.utils.PageDTO;
import org.lanqiao.music.common.utils.Result;
import org.lanqiao.music.system.entity.Album;
import org.lanqiao.music.system.service.AlbumService;
import org.lanqiao.music.system.vo.AlbumVo;
import org.lanqiao.music.system.vo.AllVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("api/Album")
public class AlbumController {
    @Autowired
    private AlbumService albumService;

    //分页查询全部
    @GetMapping("/all")
    public PageInfo<Album> getAlbum() {
        return albumService.queryByPage(new Album(),new PageDTO());
    }

    //通过id查询其他信息
    @GetMapping("/albumMusic")
    public Result searchAlbumMusic(AlbumDTO dto){
        Result result = Result.success(albumService.searchAlbumMusic(dto));
        return result;
    }

    @GetMapping("/getalbumMusic")
    public List<AlbumVo> getHotAlbum(){
        return albumService.getHotAlbumMusic();
    }

    @GetMapping("/getAllAlbum")
    public Result getAllAlbums(){
        return Result.success(albumService.quaryAllAlbums());
    }

}
